# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=nomorexor
pkgver=2.84489f9
pkgrel=4
groups=('blackarch' 'blackarch-crypto')
pkgdesc='Tool to help guess a files 256 byte XOR key by using frequency analysis.'
arch=('any')
url='https://github.com/hiddenillusion/NoMoreXOR'
license=('custom:unknown')
replaces=('nommorexor')
depends=('python2' 'python2-yara')
makedepends=('git')
source=("$pkgname::git+https://github.com/hiddenillusion/NoMoreXOR.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare(){
  cd $pkgname

  sed -i 's|env python|env python2|' NoMoreXOR.py

  chmod +x NoMoreXOR.py
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin/"
  install -dm 755 "$pkgdir/usr/share/$pkgname"
  install -dm 755 "$pkgdir/usr/share/doc/$pkgname"

  cp --no-preserve=ownership NoMoreXOR.py "$pkgdir/usr/share/$pkgname"
  cp --no-preserve=ownership Readme.md "$pkgdir/usr/share/doc/$pkgname"

  ln -s "/usr/share/$pkgname/NoMoreXOR.py" "$pkgdir/usr/bin/$pkgname"
}

